//
//  ZYQLoginUser.m
//  小庆聊天室
//
//  Created by 张毓庆 on 13-12-8.
//  Copyright (c) 2013年 张毓庆. All rights reserved.
//

#import "ZYQLoginUser.h"
#import "NSString+Helper.h"

#define kXMPPUserNameKey    @"xmppUserName"
#define kXMPPPasswordKey    @"xmppPassword"
#define kXMPPHostNameKey    @"xmppHostName"


@implementation ZYQLoginUser
single_implementation(ZYQLoginUser)

#pragma mark - 私有方法
- (NSString *)loadStringFromDefaultsWithKey:(NSString *)key
{
    NSString *string = [[NSUserDefaults standardUserDefaults] stringForKey:key];
    
    return (string) ? string : @"";
}

#pragma mark - getter和setter方法
- (NSString *)userName
{
    return  [self loadStringFromDefaultsWithKey:kXMPPUserNameKey];
}

- (void)setUserName:(NSString *)userName
{
    [userName saveToNSDefaultsWithKey:kXMPPUserNameKey];
}

- (NSString *)password
{
    return [self loadStringFromDefaultsWithKey:kXMPPPasswordKey];
}

- (void)setPassword:(NSString *)password
{
    [password saveToNSDefaultsWithKey:kXMPPPasswordKey];
}

- (NSString *)hostName
{
    return [self loadStringFromDefaultsWithKey:kXMPPHostNameKey];
}

- (void)setHostName:(NSString *)hostName
{
    [hostName saveToNSDefaultsWithKey:kXMPPHostNameKey];
}


- (NSString *)myJIDName
{
    return [NSString stringWithFormat:@"%@@%@",self.userName,self.hostName];
}
@end
